﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IOBusiness;
using IOEntity;

namespace Indochinaodyssey.UserControl.BookTour
{
    public partial class ucBookThisTour : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblTourName.Text=Request.QueryString["name"];
            txttrip.Value = Request.QueryString["name"];
        }

        protected void btnSend_Click(object sender, EventArgs e)
        {
            clsTemplete t = new clsTemplete();
            t.TourName = lblTourName.Text;
            t.Mr = txtgender.SelectedValue;
            t.Fullname = txtname.Value;
            t.Email = txtemail.Value;
            t.Address = txtaddress.Value;
            t.Nationality = txtnation.Value;
            t.Phone = txttel.Value;
            t.Fax = txtfax.Value;
            t.TourName = txttrip.Value;
            t.TripStartDate = txttripstart.Value;
            t.TripFinishingDate = txttripend.Value;
            t.AdultsNum = txtadults.SelectedValue;
            t.ChildNumL6 = txtchildren1.SelectedValue;
            t.ChildNumF6T12 = txtchildren2.SelectedValue;
            t.ChildNumR12 = txtchildren3.SelectedValue;
            t.SpecialRQ = txtrequest.Value;
            if (r1.Checked)
            {
                t.Accommodations = "1";
            }
            if (r2.Checked)
            {
                t.Accommodations = "2";
            }
            if (r3.Checked)
            {
                t.Accommodations = "3";
            }
            if (r4.Checked)
            {
                t.Accommodations = "4";
            }
            if (r5.Checked)
            {
                t.Accommodations = "5";
            }
            t.Arrivaldate = txtarrivaldate.Value;
            t.FlightNo = txtarrivaltime.Value;
            t.DepartureDate = txtdepartdate.Value;
            t.FlightNoDep = txttimedepart.Value;
            t.NamePassport = passportname.Value;
            t.Citizenship = citizenship.Value;
            t.Occupation = occupation.Value;
            t.PassportNo = passportno.Value;
            t.DateOfBirth = dateofbirth.Value;
            t.IssueDate = issuedate.Value;
            t.ExpirationDate = expirationdate.Value;
            clsBSGetHTML h = new clsBSGetHTML();
            string[] to = { "namlh@tantinh.net" };
            if (clsBSSendMail.sendMail(to, "Booking tour", h.getHTML(Request.PhysicalApplicationPath + "/HTMPTemp.htm", t)))
            {
                Response.Redirect("thank-you-contact.aspx");
            }
        }
    }
}